package com.student.system.wapper;

import com.student.system.entity.Teachermessage;

import javax.servlet.http.HttpServletRequest;

public class TeacherMessageWapper {
    public static Teachermessage teacherMessageWrapper(HttpServletRequest req){
        Teachermessage teachermessage = new Teachermessage();
        teachermessage.setName(req.getParameter("name"));
        teachermessage.setTeacherId(req.getParameter("teacherId"));
        teachermessage.setPhone(req.getParameter("phone"));
        teachermessage.setIdentity(req.getParameter("identity"));
        teachermessage.setSex(req.getParameter("sex"));
        try{
            teachermessage.setAge(Integer.parseInt(req.getParameter("age")));
        }catch (Exception e){}

        teachermessage.setEmail(req.getParameter("email"));
        teachermessage.setMajor(req.getParameter("major"));
        teachermessage.setIdentityId(req.getParameter("identityId"));
        return teachermessage;
    }
}
